package com.mywork.controller;

import com.mywork.entity.commom.CommonResult;
import com.mywork.service.StorageService;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import javax.annotation.Resource;

/**
 * @ProjectName: jekinsDemo
 * @ClassName: com.mywork.controller
 * @Author: c
 * @Date: 2021/05/06 11:23
 **/

@Controller
@RequestMapping("/")
public class HelloController {


    @Resource
    private StorageService storageService;
    /**
     * 首页
     * @return
     */
    @RequestMapping("/index")
    @ResponseBody
    public String index() {
        return storageService.index();
    }


    /**
     * 事务测试
     * @return
     */
    @RequestMapping("/test")
    @ResponseBody
    public CommonResult test() {
        storageService.test();
        return CommonResult.success();
    }

    /**
     * 模拟主键冲突异常
     * @return
     */
    @RequestMapping("/insertTest")
    @ResponseBody
    public String insertTest() {
        return storageService.insertTest();
    }






}
